package com.lm.service.impl;

import com.lm.common.excelbean.*;
import com.lm.dao.*;
import com.lm.model.*;
import com.lm.service.TrainingPlanService;
import com.lm.service.TraningPlanAllService;
import com.lm.util.*;
import com.lm.vo.CourseSimple;
import com.lm.vo.MajorSimple;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;

/**
 * @ClassName TraningPlanServiceImpl
 * @Description TODO
 * @Author wn
 * @Date 2019/4/9 15:50
 * @Version 1.0
 **/
@Service
@Transactional
public class TraningPlanAllServiceImpl implements TraningPlanAllService {
    @Autowired
    private TEntityMajorMapper majorMapper;
    @Autowired
    private TEntityCourseMapper courseMapper;
    @Autowired
    private TEntityCourseTypeMapper courseTypeMapper;
    @Autowired
    private TEntityTrainingplanMapper trainingplanMapper;
    @Autowired
    private TEntitySemesterMapper semesterMapper;
    @Autowired
    private TRelPlanCourseMapper planCourseMapper;
    @Autowired
    private TEntityPlanTrainingtargetMapper planTrainingtargetMapper;
    @Autowired
    private TEntityPlanTrainingtargetRequireMapper trainingtargetRequireMapper;
    @Autowired
    private TEntityTeachingMapper teachingMapper;
    @Autowired
    private TEntityTeachingSemesterMapper teachingSemesterMapper;
    @Autowired
    private TEntityCoursetypeInfoMapper coursetypeInfoMapper;
    @Autowired
    private TEntityCoursetypeSemesterMapper coursetypeSemesterMapper;
    @Autowired
    private TRelCourceTrainingRequireMapper courceTrainingRequireMapper;
    @Autowired
    private TEntityPlanMajorinfoMapper planMajorinfoMapper;

    @Override
    public ExcelBaseBean getTemplate() {
        ExcelBaseBean baseBean = new ExcelBaseBean();
        baseBean.setCategory("培养方案");
        baseBean.setManager("计算机系主任");
        baseBean.setCompany("山东科技大学");
        baseBean.setSubject("培养方案表");
        baseBean.setTitle("培养方案");
        baseBean.setAnthor("wn");
        baseBean.setCommnets("无");
        baseBean.setExcelName("培养方案" + Guid.get() + ".xls");
        List<ExcelSheet> excelSheets = new ArrayList<>();
        excelSheets.add(es1());
        excelSheets.add(es2());
        excelSheets.add(es3());
        excelSheets.add(es4());
        excelSheets.add(es5());
        excelSheets.add(es6());
        excelSheets.add(es7());
        baseBean.setSheets(excelSheets);
        return baseBean;
    }

    @Override
    public List<MajorSimple> getMajorSimples() {
        return majorMapper.selectAllMajorSimple();
    }

    @Override
    public List<CourseSimple> getCourseSimples() {
        return courseMapper.selectAllCourseSimple();
    }

    @Override
    public List<TEntityCourseType> getCourseTypes() {
        TEntityCourseTypeExample example = new TEntityCourseTypeExample();
        example.createCriteria();
        return courseTypeMapper.selectByExample(example);
    }

    @Override
    public boolean addEntities(PyfaBean pyfaBean) {
        //获取培养方案id
        String planId = Guid.get();
        //设置学期对应id的map
        Map<String,String> semesterMap = new HashMap<>();
        //设置培养要求对应id的map
        Map<String,String> trainingRequireMap = new HashMap<>();//
        //设置培养目标id
        String trainingtargetId = Guid.get();
        String currentUserId = SecurityUitil.getCurrentUserId();
        PyfaZsBean pyfaZsBean = pyfaBean.getPyfaZsBean();
        //添加培养方案表
        TEntityTrainingplan trainingplan = new TEntityTrainingplan();
        trainingplan.setId(planId);
        trainingplan.setName(pyfaZsBean.getName());
        trainingplan.setEnglishName(pyfaZsBean.getEnglishName());
        trainingplan.setYear(pyfaZsBean.getYear());
        trainingplan.setMajorId(pyfaZsBean.getMajorname());
        trainingplan.setCreateby(currentUserId);
        trainingplan.setEditby(currentUserId);
        trainingplan.setCreatetime(new Date());
        trainingplan.setEdittime(new Date());
        trainingplan.setStatue("1");
        trainingplanMapper.insert(trainingplan);

        //添加培养目标表
        TEntityPlanTrainingtarget planTrainingtarget = new TEntityPlanTrainingtarget();
        planTrainingtarget.setId(trainingtargetId);
        planTrainingtarget.setTarget(pyfaZsBean.getPlanTarget());
        planTrainingtarget.setPlanId(planId);
        planTrainingtarget.setCreateby(currentUserId);
        planTrainingtarget.setEditby(currentUserId);
        planTrainingtarget.setCreatetime(new Date());
        planTrainingtarget.setEdittime(new Date());
        planTrainingtarget.setStatue("1");
        planTrainingtargetMapper.insert(planTrainingtarget);

        //添加专业信息
        TEntityPlanMajorinfo planMajorinfo = new TEntityPlanMajorinfo();
        planMajorinfo.setId(Guid.get());
        planMajorinfo.setPlanId(planId);
        planMajorinfo.setDegree(pyfaZsBean.getSyxw());
        planMajorinfo.setLimitYear((int)Double.parseDouble(pyfaZsBean.getLimitYear()));
        planMajorinfo.setMinCredit((int)Double.parseDouble(pyfaZsBean.getMinCredit()));
        planMajorinfo.setIntroduction(pyfaZsBean.getMajorIntroduction());
        planMajorinfo.setRequirementDescription(pyfaZsBean.getRequireContext());
        planMajorinfo.setCreateby(currentUserId);
        planMajorinfo.setEditby(currentUserId);
        planMajorinfo.setCreatetime(new Date());
        planMajorinfo.setEdittime(new Date());
        planMajorinfo.setStatue("1");
        planMajorinfoMapper.insert(planMajorinfo);

        //添加学期周数
        List<SemesterWeek> semesterWeeks = pyfaBean.getSemesterWeeks();
        for (SemesterWeek semesterWeek : semesterWeeks) {
            String semesterId = Guid.get();
            TEntitySemester semester = new TEntitySemester();
            semester.setId(semesterId);
            semester.setPlanId(planId);
            semester.setSemester(semesterWeek.getSemester());
            semester.setWeek((int)Double.parseDouble(semesterWeek.getWeek()));
            semester.setCreateby(currentUserId);
            semester.setEditby(currentUserId);
            semester.setCreatetime(new Date());
            semester.setEdittime(new Date());
            semesterMap.put(semesterWeek.getSemester(),semesterId);
            semesterMapper.insert(semester);
        }

        //添加主干课程
        List<MainCourse> mainCourses = pyfaBean.getMainCourses();
        for (MainCourse mainCourse : mainCourses) {
            TRelPlanCourse planCourse = new TRelPlanCourse();
            planCourse.setPlanId(planId);
            planCourse.setCourseId(mainCourse.getCourseName());
            planCourse.setId(Guid.get());
            planCourse.setCreateby(currentUserId);
            planCourse.setEditby(currentUserId);
            planCourse.setCreatetime(new Date());
            planCourse.setEdittime(new Date());
            planCourse.setStatue("1");
            planCourseMapper.insert(planCourse);
        }

        //添加培养要求
        List<TrainingRequire> trainingRequires = pyfaBean.getTrainingRequires();
        for (TrainingRequire trainingRequire : trainingRequires) {
            TEntityPlanTrainingtargetRequire planTrainingtargetRequire = new TEntityPlanTrainingtargetRequire();
            String targetRequireId = Guid.get();
            planTrainingtargetRequire.setTargetId(trainingtargetId);
            planTrainingtargetRequire.setId(targetRequireId);
            planTrainingtargetRequire.setContext(trainingRequire.getRequire());
            planTrainingtargetRequire.setCreateby(currentUserId);
            planTrainingtargetRequire.setEditby(currentUserId);
            planTrainingtargetRequire.setCreatetime(new Date());
            planTrainingtargetRequire.setEdittime(new Date());
            planTrainingtargetRequire.setStatue("1");
            trainingtargetRequireMapper.insert(planTrainingtargetRequire);
            trainingRequireMap.put(trainingRequire.getCode(),targetRequireId);
        }

        //添加课程计划
        List<CoursePlan> coursePlans = pyfaBean.getCoursePlans();
        for (CoursePlan coursePlan : coursePlans) {
            String teachingId = Guid.get();
            TEntityTeaching teaching = new TEntityTeaching();
            teaching.setId(teachingId);
            teaching.setPlanId(planId);
            teaching.setCourseId(coursePlan.getName());
            teaching.setAllCredit((int)(Double.parseDouble(coursePlan.getAllCredit())));
            teaching.setTheory((int)(Double.parseDouble(coursePlan.getLnxs())));
            teaching.setPractice((int)(Double.parseDouble(coursePlan.getSjxs())));
            teaching.setCreateby(currentUserId);
            teaching.setEditby(currentUserId);
            teaching.setCreatetime(new Date());
            teaching.setEdittime(new Date());
            teaching.setStatue("1");
            teachingMapper.insert(teaching);
            //第一学期
            if (!StringUtils.isEmpty(coursePlan.getXq1())) {
                TeachingSemesterHelp(coursePlan.getXq1(),planId,teachingId,semesterMap.get("第一学期"));
            }
            //第二学期
            if (!StringUtils.isEmpty(coursePlan.getXq2())) {
                TeachingSemesterHelp(coursePlan.getXq2(),planId,teachingId,semesterMap.get("第二学期"));
            }
            //第三学期
            if (!StringUtils.isEmpty(coursePlan.getXq3())) {
                TeachingSemesterHelp(coursePlan.getXq3(),planId,teachingId,semesterMap.get("第三学期"));
            }
            //第四学期
            if (!StringUtils.isEmpty(coursePlan.getXq4())) {
                TeachingSemesterHelp(coursePlan.getXq4(),planId,teachingId,semesterMap.get("第四学期"));
            }
            //第五学期
            if (!StringUtils.isEmpty(coursePlan.getXq5())) {
                TeachingSemesterHelp(coursePlan.getXq5(),planId,teachingId,semesterMap.get("第五学期"));
            }
            //第六学期
            if (!StringUtils.isEmpty(coursePlan.getXq6())) {
                TeachingSemesterHelp(coursePlan.getXq6(),planId,teachingId,semesterMap.get("第六学期"));
            }
            //第七学期
            if (!StringUtils.isEmpty(coursePlan.getXq7())) {
                TeachingSemesterHelp(coursePlan.getXq7(),planId,teachingId,semesterMap.get("第七学期"));
            }
            //第八学期
            if (!StringUtils.isEmpty(coursePlan.getXq8())) {
                TeachingSemesterHelp(coursePlan.getXq8(),planId,teachingId,semesterMap.get("第八学期"));
            }
        }

        //添加课程体系架构
        List<CourseStruction> courseStructions = pyfaBean.getCourseStructions();
        for (CourseStruction courseStruction : courseStructions) {
            TEntityCoursetypeInfo coursetypeInfo = new TEntityCoursetypeInfo();
            String coursetypeInfoId = Guid.get();
            coursetypeInfo.setId(coursetypeInfoId);
            coursetypeInfo.setPlanId(planId);
            coursetypeInfo.setCourseTypeId(courseStruction.getCourseType());
            coursetypeInfo.setAllCredit((int)Double.parseDouble(courseStruction.getAllCredit()));
            coursetypeInfo.setTheory((int)Double.parseDouble(courseStruction.getLnxs()));
            coursetypeInfo.setPractice((int)Double.parseDouble(courseStruction.getSjxs()));
            coursetypeInfo.setCreateby(currentUserId);
            coursetypeInfo.setEditby(currentUserId);
            coursetypeInfo.setCreatetime(new Date());
            coursetypeInfo.setEdittime(new Date());
            coursetypeInfo.setStatue("1");
            coursetypeInfoMapper.insert(coursetypeInfo);

            if (!StringUtils.isEmpty(courseStruction.getXqxf1())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf1(),courseStruction.getXqxs1(),semesterMap.get("第一学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf2())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf2(),courseStruction.getXqxs2(),semesterMap.get("第二学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf3())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf3(),courseStruction.getXqxs3(),semesterMap.get("第三学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf4())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf4(),courseStruction.getXqxs4(),semesterMap.get("第四学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf5())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf5(),courseStruction.getXqxs5(),semesterMap.get("第五学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf6())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf6(),courseStruction.getXqxs6(),semesterMap.get("第六学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf7())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf7(),courseStruction.getXqxs7(),semesterMap.get("第七学期"));
            }
            if (!StringUtils.isEmpty(courseStruction.getXqxf8())) {
                CoursetypeSemesterHelp(coursetypeInfoId,courseStruction.getXqxf8(),courseStruction.getXqxs8(),semesterMap.get("第八学期"));
            }
        }

        //添加关系矩阵
        List<Gxjz> gxjzs = pyfaBean.getGxjzs();
        for (Gxjz gxjz : gxjzs) {
            Map<String, Boolean> codeMap = gxjz.getCodeMap();
            Set<String> strings = codeMap.keySet();
            for (String string : strings) {
                if (codeMap.get(string)){
                    TRelCourceTrainingRequire courceTrainingRequire = new TRelCourceTrainingRequire();
                    courceTrainingRequire.setId(Guid.get());
                    courceTrainingRequire.setPlanId(planId);
                    courceTrainingRequire.setCourseId(gxjz.getCourseName());
                    courceTrainingRequire.setTrainingRequire(trainingRequireMap.get(string));
                    courceTrainingRequire.setCreateby(currentUserId);
                    courceTrainingRequire.setEditby(currentUserId);
                    courceTrainingRequire.setCreatetime(new Date());
                    courceTrainingRequire.setEdittime(new Date());
                    courceTrainingRequire.setStatue("1");
                    courceTrainingRequireMapper.insert(courceTrainingRequire);
                }
            }
        }
        return true;
    }

    public ExcelSheet es1 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("培养方案综述");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"培养方案名称");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"英文名称");
        ExcelSheetTitle title3 = new ExcelSheetTitle(2,30 * 256,"制定年份");
        ExcelSheetTitle title4 = new ExcelSheetTitle(3,30 * 256,"关联专业");
        ExcelSheetTitle title5 = new ExcelSheetTitle(4,30 * 256,"修业年限");
        ExcelSheetTitle title6 = new ExcelSheetTitle(5,30 * 256,"授予学位");
        ExcelSheetTitle title7 = new ExcelSheetTitle(6,30 * 256,"毕业最低分");
        ExcelSheetTitle title8 = new ExcelSheetTitle(7,30 * 256,"专业介绍");
        ExcelSheetTitle title9 = new ExcelSheetTitle(8,30 * 256,"毕业要求描述");
        ExcelSheetTitle title10 = new ExcelSheetTitle(9,30 * 256,"培养目标");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheetTitles.add(title3);
        sheetTitles.add(title4);
        sheetTitles.add(title5);
        sheetTitles.add(title6);
        sheetTitles.add(title7);
        sheetTitles.add(title8);
        sheetTitles.add(title9);
        sheetTitles.add(title10);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es2 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("学期周数");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,60 * 256,"学期(第一学期/第二学期**/第八学期)");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"周数");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es3 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("主干课程");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"主干课程名");
        sheetTitles.add(title1);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es4 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("培养要求");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"培养要求");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"编码");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es5 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("课程计划");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"课程名称");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"总学分");
        ExcelSheetTitle title3 = new ExcelSheetTitle(2,30 * 256,"理论学时");
        ExcelSheetTitle title4 = new ExcelSheetTitle(3,30 * 256,"实践学时");
        ExcelSheetTitle title5 = new ExcelSheetTitle(4,30 * 256,"第一学期");
        ExcelSheetTitle title6 = new ExcelSheetTitle(5,30 * 256,"第二学期");
        ExcelSheetTitle title7 = new ExcelSheetTitle(6,30 * 256,"第三学期");
        ExcelSheetTitle title8 = new ExcelSheetTitle(7,30 * 256,"第四学期");
        ExcelSheetTitle title9 = new ExcelSheetTitle(8,30 * 256,"第五学期");
        ExcelSheetTitle title10 = new ExcelSheetTitle(9,30 * 256,"第六学期");
        ExcelSheetTitle title11 = new ExcelSheetTitle(10,30 * 256,"第七学期");
        ExcelSheetTitle title12 = new ExcelSheetTitle(11,30 * 256,"第八学期");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheetTitles.add(title3);
        sheetTitles.add(title4);
        sheetTitles.add(title5);
        sheetTitles.add(title6);
        sheetTitles.add(title7);
        sheetTitles.add(title8);
        sheetTitles.add(title9);
        sheetTitles.add(title10);
        sheetTitles.add(title11);
        sheetTitles.add(title12);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es6 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("课程体系架构");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"课程类别(通识必修课，通识选修课，基础必修课，基础选修课，专业必修课，专业选修课)");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"课程总学分");
        ExcelSheetTitle title3 = new ExcelSheetTitle(2,30 * 256,"理论学时");
        ExcelSheetTitle title4 = new ExcelSheetTitle(3,30 * 256,"实践学时");
        ExcelSheetTitle title5 = new ExcelSheetTitle(4,30 * 256,"第一学期总学分");
        ExcelSheetTitle title6 = new ExcelSheetTitle(5,30 * 256,"第一学期周学时");
        ExcelSheetTitle title7 = new ExcelSheetTitle(6,30 * 256,"第二学期总学分");
        ExcelSheetTitle title8 = new ExcelSheetTitle(7,30 * 256,"第二学期周学时");
        ExcelSheetTitle title9 = new ExcelSheetTitle(8,30 * 256,"第三学期总学分");
        ExcelSheetTitle title10 = new ExcelSheetTitle(9,30 * 256,"第三学期周学时");
        ExcelSheetTitle title11 = new ExcelSheetTitle(10,30 * 256,"第四学期总学分");
        ExcelSheetTitle title12 = new ExcelSheetTitle(11,30 * 256,"第四学期周学时");
        ExcelSheetTitle title13 = new ExcelSheetTitle(12,30 * 256,"第五学期总学分");
        ExcelSheetTitle title14 = new ExcelSheetTitle(13,30 * 256,"第五学期周学时");
        ExcelSheetTitle title15 = new ExcelSheetTitle(14,30 * 256,"第六学期总学分");
        ExcelSheetTitle title16 = new ExcelSheetTitle(15,30 * 256,"第六学期周学时");
        ExcelSheetTitle title17 = new ExcelSheetTitle(16,30 * 256,"第七学期总学分");
        ExcelSheetTitle title18 = new ExcelSheetTitle(17,30 * 256,"第七学期周学时");
        ExcelSheetTitle title19 = new ExcelSheetTitle(18,30 * 256,"第八学期总学分");
        ExcelSheetTitle title20 = new ExcelSheetTitle(19,30 * 256,"第八学期周学时");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheetTitles.add(title3);
        sheetTitles.add(title4);
        sheetTitles.add(title5);
        sheetTitles.add(title6);
        sheetTitles.add(title7);
        sheetTitles.add(title8);
        sheetTitles.add(title9);
        sheetTitles.add(title10);
        sheetTitles.add(title11);
        sheetTitles.add(title12);
        sheetTitles.add(title13);
        sheetTitles.add(title14);
        sheetTitles.add(title15);
        sheetTitles.add(title16);
        sheetTitles.add(title17);
        sheetTitles.add(title18);
        sheetTitles.add(title19);
        sheetTitles.add(title20);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public ExcelSheet es7 () {
        ExcelSheet sheet = new ExcelSheet();
        sheet.setCreateSheet("课程与培养要求关系矩阵");
        List<ExcelSheetTitle> sheetTitles = new ArrayList<>();
        ExcelSheetTitle title1 = new ExcelSheetTitle(0,30 * 256,"课程名称/培养要求编码（请与培养要求的编码一致）");
        ExcelSheetTitle title2 = new ExcelSheetTitle(1,30 * 256,"r1");
        ExcelSheetTitle title3 = new ExcelSheetTitle(2,30 * 256,"r2");
        ExcelSheetTitle title4 = new ExcelSheetTitle(3,30 * 256,"r3");
        ExcelSheetTitle title5 = new ExcelSheetTitle(4,30 * 256,"r4");
        ExcelSheetTitle title6 = new ExcelSheetTitle(5,30 * 256,"r5");
        ExcelSheetTitle title7 = new ExcelSheetTitle(6,30 * 256,"r6");
        ExcelSheetTitle title8 = new ExcelSheetTitle(7,30 * 256,"r7");
        sheetTitles.add(title1);
        sheetTitles.add(title2);
        sheetTitles.add(title3);
        sheetTitles.add(title4);
        sheetTitles.add(title5);
        sheetTitles.add(title6);
        sheetTitles.add(title7);
        sheetTitles.add(title8);
        sheet.setSheetTitles(sheetTitles);
        return sheet;
    }

    public void TeachingSemesterHelp (String xqnum,String planId,String teachingId,String semesterId) {
        TEntityTeachingSemester teachingSemester = new TEntityTeachingSemester();
        teachingSemester.setId(Guid.get());
        teachingSemester.setPlanId(planId);
        teachingSemester.setTeachingId(teachingId);
        teachingSemester.setSemesterId(semesterId);
        teachingSemester.setWeekCount((int)Double.parseDouble(xqnum));
        teachingSemester.setCreateby(SecurityUitil.getCurrentUserId());
        teachingSemester.setEditby(SecurityUitil.getCurrentUserId());
        teachingSemester.setCreatetime(new Date());
        teachingSemester.setEdittime(new Date());
        teachingSemester.setStatue("1");
        teachingSemesterMapper.insert(teachingSemester);
    }

    public void CoursetypeSemesterHelp (String coursetypeId,String xqnum,String zsnum,String semesterId) {
        TEntityCoursetypeSemester coursetypeSemester = new TEntityCoursetypeSemester();
        coursetypeSemester.setId(Guid.get());
        coursetypeSemester.setCoursetypeId(coursetypeId);
        coursetypeSemester.setSemesterId(semesterId);
        coursetypeSemester.setCreditCount((int)Double.parseDouble(xqnum));
        coursetypeSemester.setWeekCount((int)Double.parseDouble(zsnum));
        coursetypeSemester.setCreateby(SecurityUitil.getCurrentUserId());
        coursetypeSemester.setEditby(SecurityUitil.getCurrentUserId());
        coursetypeSemester.setCreatetime(new Date());
        coursetypeSemester.setEdittime(new Date());
        coursetypeSemester.setStatue("1");
        coursetypeSemesterMapper.insert(coursetypeSemester);
    }


}
